package top.minuy.structure.graph.representations.table;

import top.minuy.res.graph.GraphRes;

/**
 * 邻接表测试
 * v2
 * 有向测试
 * V3 动态图测试
 *
 * @author Minuy
 * @time 9:37
 * @date 2021/11/25
 */
public class TestDynamic {
    public static void main(String[] args) {

        System.out.println("----------------动态图验证：");
        WeightedGraphDynamic wgd = new WeightedGraphDynamic(true);
        System.out.println("图创建后：");
        System.out.println(wgd);

        wgd.addVertex(15);
        wgd.addVertex(16);
        wgd.addVertex("fish");
        wgd.addVertex("cat");
        wgd.addVertex("dog");
        System.out.println("添加5个顶点后：");
        System.out.println(wgd);

        wgd.addEdge(15,16,154);
        wgd.addEdge("fish",16,204);
        wgd.addEdge("fish","dog",247);
        wgd.addEdge("fish","cat",268);
        wgd.addEdge("15","cat",261);
        wgd.addEdge("15","dog",208);
        wgd.addEdge("cat","16",298);
        wgd.addEdge("fish","15",298);
        System.out.println("添加8条边后：");
        System.out.println(wgd);

        wgd.removeEdge("fish",16);
        wgd.removeEdge("15",16);
        System.out.println("删除2条边后：");
        System.out.println(wgd);

        wgd.removeVertex("fish");
        wgd.removeVertex("15");
        System.out.println("删除2个顶点后：");
        System.out.println(wgd);


        wgd.setWeight("cat",16,666);
        System.out.println("修改1条边权值后：");
        System.out.println(wgd);


        System.out.println("----------------动态图验证：");
        GraphDynamic gd = new GraphDynamic();
        System.out.println("图创建后：");
        System.out.println(gd);

        gd.addVertex(15);
        gd.addVertex(16);
        gd.addVertex("fish");
        gd.addVertex("cat");
        gd.addVertex("dog");
        System.out.println("添加5个顶点后：");
        System.out.println(gd);

        gd.addEdge(15,16);
        gd.addEdge("fish",16);
        gd.addEdge("fish","dog");
        gd.addEdge("fish","cat");
        gd.addEdge("15","cat");
        gd.addEdge("15","dog");
        gd.addEdge("cat","16");
        gd.addEdge("fish","15");
        System.out.println("添加8条边后：");
        System.out.println(gd);

        gd.removeEdge("fish",16);
        gd.removeEdge("15",16);
        System.out.println("删除2条边后：");
        System.out.println(gd);

        gd.removeVertex("fish");
        gd.removeVertex("15");
        System.out.println("删除2个顶点后：");
        System.out.println(gd);
    }
}
